<?php
ini_set('display_errors', 1);
error_reporting(-1);
require_once '/data/wwwroot/g_vendor/autoload.php';

use Biz\model\ShopFavorite as mShopFavorite;
use Doraemon\cache\Queue;
use Doraemon\service\MemberRoleTag;
use Doraemon\service\Visitor;

$id = 0;
$info = mShopFavorite::get('*', [
	'id[>]' => $id,
	'uid[!]' => 0,
	'status' => mShopFavorite::STATUS_NORMAL,
	'ORDER' => ['id' => 'ASC'],
]);
while ($info) {
	$vid = Visitor::getVidByUid($info['uid']);
	Queue::insertQueue('queue/UserRole/SaveRoleTag', [
		'vid' => $vid,//vid
		'tag_id' => MemberRoleTag::ROLE_TAG_FAV_GOODS,//分群id
		'value' => 2,//对应的值
		'uid' => $info['uid'],
	], Queue::QUEUE_ROLE_TAG);

	echo $id . "\r\n";

	$id = $info['id'];

	$info = mShopFavorite::get('*', [
		'id[>]' => $id,
		'uid[!]' => 0,
		'status' => mShopFavorite::STATUS_NORMAL,
		'ORDER' => ['id' => 'ASC'],
	]);
}
